package com.escool.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.escool.model.TbSedeHasPersonal;
import com.escool.service.SedeHasPersonalService;

@Controller
public class ProfMateriaController {
	
	@Autowired
	SedeHasPersonalService sedeHasPersonalService;
	
	
	@RequestMapping("showSucursalProfesor")
	public String showCatActividad(Map<String, Object> map){
		try{
			User user = (User)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
			map.put("SedePersonal", new TbSedeHasPersonal());
			map.put("TbSedeHasPersonalList", sedeHasPersonalService.listVwPersonalSedeByEmp(user.getUsername()));
			return "/sucursalProfesor";
		}catch(Exception ex){
			return "redirect:/login";
		}
			
	}

}
